<template>
	<view class="u-flex">
	  <text class="icon color-blue u-m-r-6" style="font-weight: 700;font-size:44rpx">&#xe64f;</text>
	  <text class="color-blue u-font-30" @click="preview(item.Src)">{{item.Name}}</text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pdfUrl:'',
			}
		},
		props: {
			item: {
				type: Object,
				default: null
			},
			index: {
				type: Number,
				default: 0,
			},
		},
		methods: {
			//预览pdf
			preview(pdfUrl){
					uni.showLoading();
					let urlPath=pdfUrl.replace(/http:/g,"https:")
					uni.downloadFile({
							url: urlPath,
							success: (rest) => {
									let filePath = rest.tempFilePath
									uni.openDocument({
											filePath: filePath,
											success: function(res) {
													uni.hideLoading()
											}
									})
							}
					})
			},
		}
	}
</script>
<style>
	.color-blue{
		color: #0089FF;
	}
</style>